<?php
namespace app\navbar\loglic;

class Common
{
    /**
    * 定义菜单模型的字段
    * @version 1.0.0 首次引入
    * @param array $data 可选;初始数据;默认：空
    * @return array 表格列字段属性（DcBuildTable）
    */
    public function fields($data)
    {

        //表单初始化字段
        return [
            'html_1' => [
                'type'            => 'html',
                'value'           => '<div class="row"><div class="col-12 col-md-8">',
                'order'           => 0,
            ],
            'term_id' => [
                'type'            => 'hidden',
                'value'           => $data['term_id'],
                'order'           => 1,
                'data-filter'     => false,
                'data-visible'    => true,
                'data-width'      => '80',
                'data-width-unit' => 'px',
                'data-sortable'   => true,
            ],
            'term_type' => [
                'type'            => 'hidden',
                'value'           => 'navs',
                'order'           => 1,
                'data-filter'     => false,
                'data-visible'    => false,
            ],
            'term_parent' => [
                'type'            => 'select',
                'value'           => $data['term_parent'],
                'order'           => 201,
                'option'          => navbarOption(['module'=>input('get.term_module')]),
            ],
            'term_name' => [
                'type'            => 'text',
                'value'           => $data['term_name'],
                'order'           => 11,
                'title'           => lang('navs_name'),
                'required'        => true,
                'data-filter'     => false,
                'data-visible'    => true,
                'data-align'      => 'left',
            ],
            'navs_url' => [
                'type'            => 'text',
                'value'           => $data['navs_url'],
                'order'           => 21,
                'data-filter'     => false,
                'data-visible'    => true,
                'data-align'      => 'left',
            ],
            'navs_image' => [
                'type'            => 'image',
                'value'           => $data['navs_image'],
                'order'           => 31,
                'data-filter'     => false,
                'data-visible'    => false,
            ],
            'navs_class' => [
                'type'            => 'text',
                'value'           => $data['navs_class'],
                'order'           => 41,
                'data-filter'     => false,
                'data-visible'    => false,
            ],
            'navs_active' => [
                'type'            => 'text',
                'value'           => $data['navs_active'],
                'order'           => 51,
                'data-filter'     => false,
                'data-visible'    => true,
                'data-width'      => 100,
            ],
            'term_info' => [
                'type'            => 'text',
                'value'           => $data['term_info'],
                'title'           => lang('navs_info'),
                'order'           => 61,
                'data-filter'     => false,
                'data-visible'    => false,
            ],
            'html_2'      => [
                'type'            => 'html',
                'value'           => '</div><div class="col-12 col-md-4">',
                'order'           => 199,
            ],
            'term_order' => [
                'type'            => 'number',
                'value'           => intval($data['term_order']),
                'order'           => 241,
                'data-filter'     => false,
                'data-visible'    => true,
                'data-width'      => 100,
                'data-sortable'   => true,
            ],
            'navs_target' => [
                'type'            => 'select',
                'value'           => DcEmpty($data['navs_target'],'_self'),
                'option'          => [
                    '_blank'      => lang('target_option_0'),
                    '_self'       => lang('target_option_1'),
                    '_parent'     => lang('target_option_2'),
                    '_top'        => lang('target_option_3'),
                    '_new'        => lang('target_option_4')
                ],
                'order'           => 221,
                'title'           => lang('navs_target'),
                'data-filter'     => false,
                'data-visible'    => true,
                'data-width'      => 100,
            ],
            'term_status' => [
                'type'            => 'select',
                'value'           => DcEmpty($data['term_status'],'normal'),
                'option'          => ['normal'=>lang('normal'),'hidden'=>lang('hidden'),'private'=>lang('private'),'public'=>lang('public')],
                'order'           => 231,
                'data-filter'     => true,
                'data-visible'    => false,
            ],
            'term_status_text' => [
                'order'           => 231,
                'data-title'      => lang('term_status'),
                'data-visible'    => true,
                'data-width'      => 100,
            ],
            'term_action' => [
                'type'            => 'select',
                'value'           => DcEmpty($data['term_action'],'index'),
                'option'          => [
                    'navbar'      => lang('navs_navbar'),
                    'sitebar'     => lang('navs_sitebar'),
                    'navs'        => lang('navs_navs'),
                    'links'       => lang('navs_links'),
                    'ico'         => lang('navs_ico'),
                    'image'       => lang('navs_image'),
                    'other'       => lang('navs_other'),
                ],
                'order'           => 211,
                'data-filter'     => true,
                'data-visible'    => true,
                'data-width'      => 100,
                //'data-formatter'  => 'daicuo.admin.navbar.formatter',
            ],
            'term_controll' => [
                'type'            => 'text',
                'value'           => DcEmpty($data['term_controll'],'detail'),
                'order'           => 81,
                'placeholder'     => '',
                'data-filter'     => false,
                'data-visible'    => true,
                'data-width'      => 100,
                //'data-formatter'  => 'daicuo.admin.navbar.formatter',
            ],
            'term_module' => [
                'type'            => 'text',
                'value'           => DcEmpty($data['term_module'],'navbar'),
                'order'           => 71,
                'data-filter'     => false,
                'data-visible'    => true,
                'data-width'      => 100,
                //'data-formatter'  => 'daicuo.admin.navbar.formatter',
            ],
            'html_3' => [
              'type'              => 'html',
              'value'             => '</div></div>',
              'order'             => 999,
            ]
        ];
    }
}